<template>
  <h1>事件绑定指令</h1>
  <button v-on:click="f">按钮1</button>
  <button @click="f">按钮2</button>

  <h2>敲回车事件</h2>
<!--v-model指令: 双向绑定可以将页面输入的值存入search变量中
    @keyup.enter: 敲回车事件:调用ent函数-->
  <input type="text" placeholder="输入内容" v-model="search" @keyup.enter="ent">
</template>
<script setup>
import {ref} from "vue";
const f = () => {
  alert('按钮被点击了')
}
const search = ref('');
const ent = () => {
  alert(search.value);
}
</script>
<style scoped>

</style>